//++
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
// Module Name:
//
//  Constants.cs
//    
// Abstract:
//
//  Defines constants used by Microsoft Enhanced Reminders.
//  
//--

using System;

namespace Microsoft.EnhancedReminders
{
    /// <summary>
    /// Defines various constants used throughout Enhanced Reminders components.
    /// </summary>
    public static class Constants
    {
        /// <summary>
        /// File name of the hidden attachment to enhanced reminders that holds the reminder details.
        /// </summary>
        public const string AttachmentName = "MicrosoftEnhancedReminders.dat";

        /// <summary>
        /// The name of the storage item used to store rules.
        /// </summary>
        public const string StorageItemName = "Microsoft EnhancedReminders Storage Item - Please ignore and do not delete";

        /// <summary>
        /// The name of the folder containing the storage item used to store rules.
        /// </summary>
        public const string StorageItemFolderName = "Microsoft Enhanced Reminders Storage Item Folder - Please ignore and do not delete";

        /// <summary>
        /// Name of the MSMQ used between the Scheduler and the Dispatcher.
        /// </summary>
        public const string SendQueueName = "EnhancedRemindersNotifications";

        /// <summary>
        /// Polling interval for creating Enhanced Reminders search folder.
        /// </summary>
        public static readonly TimeSpan SearchFolderPollingInterval = TimeSpan.FromSeconds(10);

        /// <summary>
        /// The maximum interval to use for the timer used by the Scheduler. If the next reminder is
        /// over 30 days away, we'll determine a more accurate time after 30 days since the timer class
        /// will not let us set values greater than 50 days.
        /// </summary>
        public static readonly long MaxScheduleTimerSpan = (long)TimeSpan.FromDays(30).TotalMilliseconds;

        /// <summary>
        /// The maximum size in bytes for audio attachments used in voicemail reminders.
        /// 
        /// If this value is modified, the "maxBufferSize" and the "maxReceivedMessageSize" 
        /// attributes of the "ExchangeServiceBinding" element in the Scheduler's 
        /// app.config need to be changed accordingly. 
        /// 
        /// Currently set to 10MB, which should be fine for a 5 minute 16bit 8kHz WAV file. 
        /// </summary>
        public static readonly int MaxAudioFileSizeInBytes = 10485760;

        /// <summary>
        /// Defines a LDAP query for looking someone up via their e-mail address.
        /// </summary>
        public static readonly string LdapEmailQuery = "(&(objectCategory=person)(objectClass=user)(mail={0}))";

        /// <summary>
        /// Defines the key in Active Directory for a user's SIP address
        /// </summary>
        public static readonly string LdapSipEntry = "msrtcsip-primaryuseraddress";

        /// <summary>
        /// Name of the configuration setting that specifies how often subscription status updates should be sent by EWS.
        /// </summary>
        public static readonly string SubscriptionStatusFrequencyInMinutesSetting = "SubscriptionStatusFrequencyInMinutes";

        /// <summary>
        /// Name of the configuration setting that specifies if delegation should be used to access users' mailboxes.
        /// </summary>
        public static readonly string UseDelegationSetting = "UseDelegation";

        /// <summary>
        /// Name of the configuration setting that specifies the address of the web service to receive notifications from EWS.
        /// </summary>
        public static readonly string NotificationServiceUrlSetting = "NotificationServiceURL";

        /// <summary>
        /// Name of the configuration setting that specifies the root of the LDAP query for finding users.
        /// </summary>
        public static readonly string ActiveDirectoryRootSetting = "ActiveDirectoryRoot";

        /// <summary>
        /// Name of the configuration setting that specifies the membership DL for users.
        /// </summary>
        public static readonly string MembershipDLSetting = "MembershipDL";

        /// <summary>
        /// Name of the configuration setting that specifies the cut-off point for past due notifications.
        /// </summary>
        public static readonly string SendCutoffPeriodInMinutesSetting = "SendCutoffPeriodInMinutes";

        /// <summary>
        /// Name of the configuration setting that specifies the shutdown timeout.
        /// </summary>
        public static readonly string ShutdownTimeoutInSecondsSetting = "ShutdownTimeoutInSeconds";

        /// <summary>
        /// Name of the configuration setting that specifies the diagnostic logging level.
        /// </summary>
        public static readonly string TraceLogLevelSetting = "TraceLogLevel";

        /// <summary>
        /// Name of the configuration setting that specifies if a debugger should be attached when the service starts.
        /// </summary>
        public static readonly string LaunchDebuggerSetting = "LaunchDebugger";

        /// <summary>
        /// Prefix used for SIP Addresses
        /// </summary>
        public static readonly string SipPrefix = "sip:";

        /// <summary>
        /// Prefix used for telephony URIs.
        /// </summary>
        public static readonly string TelPrefix = "tel:";

        /// <summary>
        /// Number of occurences to fetch in a single request when determining the next
        /// occurence of a recurring meeting.
        /// </summary>
        public static readonly int OccurrencesToFetch = 15;

        /// <summary>
        /// Custom property ID for the reminders custom property.
        /// </summary>
        public static readonly string ReminderPropertyId = new Guid("{4E719E9C-C5E9-4b89-A7FA-9874F3E61CE8}").ToString("D");

        /// <summary>
        /// Custom property name for the reminders custom property.
        /// </summary>
        public const string ReminderPropertyName = "EnhancedReminder";

        /// <summary>
        /// Custom property ID for the rule ID custom property.
        /// </summary>
        public static readonly string ReminderRuleIdPropertyId = new Guid("{CA4705F3-7EA2-4015-A57C-6159DFC4344E}").ToString("D");

        /// <summary>
        /// Custom property name for the rule ID custom property.
        /// </summary>
        public const string ReminderRuleIdPropertyName = "EnhancedReminderRuleId";

        /// <summary>
        /// Custom property ID for the rule ID custom property.
        /// </summary>
        public static readonly string JoinNowRuleIdPropertyId = new Guid("{91BAB62B-EF7A-421a-8BC5-EFEA6DBEB30B}").ToString("D");

        /// <summary>
        /// Custom property name for the rule ID custom property.
        /// </summary>
        public const string JoinNowRuleIdPropertyName = "JoinNowRuleId";

        /// <summary>
        /// Custom property ID for the Live Meeting join info property.
        /// </summary>
        public static readonly string JoinInfoPropertyId = new Guid("{00020329-0000-0000-C000-000000000046}").ToString("D");

        /// <summary>
        /// Custom property name for the Live Meeting join info property.
        /// </summary>
        public const string JoinInfoPropertyName = "JoinInfo";

        /// <summary>
        /// Custom property name for when the reminder was delivered.
        /// </summary>
        public const string ReminderDeliveredPropertyName = "ReminderDeliveredAt";

        /// <summary>
        /// Custom property ID for when the reminder was delivered.
        /// </summary>
        public static readonly string ReminderDeliveredPropertyId = new Guid("{656005D2-6300-4a23-BAD3-9C31D9FCA346}").ToString("D");


        /// <summary>
        /// Custom property ID for when the reminder on a recurring meeting exception was deleted.
        /// </summary>
        public static readonly string ReminderOnExceptionDeletedPropertyId = new Guid("{29B98184-A81D-46f3-A015-3CAA54285FC2}").ToString("D");

        /// <summary>
        /// Custom property name for when the reminder on a recurring meeting exception was deleted.
        /// </summary>
        public const string ReminderOnExceptionDeletedPropertyName = "ReminderOnExceptionWasDeleted";

        /// <summary>
        /// Message class used to designate Live Meetings and Conference Calls.
        /// </summary>
        public const string LiveMeetingMessageClass = "IPM.Appointment.Live Meeting Request";

        /// <summary>
        /// Message class used to denote an exception to a recurring meeting.
        /// </summary>
        public const string RecurringMeetingExceptionMessageClass = "IPM.OLE.CLASS.{00061055-0000-0000-C000-000000000046}";

        /// <summary>
        /// The ID value of the Enhanced Reminders trusted service entry in AD.
        /// </summary>
        public const string EnhancedRemindersPlatformName = "enhanced_reminders";
    }
}
